/* GUI CONVERTED from rcsomta.p (converter v1.76) Mon Jun 10 11:10:10 2002 */
/* rcsomta.p - Release Management Customer Schedules                          */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.8.1.7 $                                                   */
/*                                                                            */
/* REVISION: 7.3      LAST MODIFIED: 10/09/92           BY: WUG *G462*        */
/* REVISION: 7.3      LAST MODIFIED: 05/24/93           BY: WUG *GB29*        */
/* REVISION: 7.4      LAST MODIFIED: 08/11/93           BY: bcm *H064*        */
/* REVISION: 7.4      LAST MODIFIED: 09/20/94           BY: ljm *GM77*        */
/* REVISION: 7.4      LAST MODIFIED: 03/29/95           BY: bcm *G0JS*        */
/* REVISION: 7.3      LAST MODIFIED: 08/15/95           BY: bcm *G0TB*        */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 10/01/99   BY: *N014* Robin McCarthy     */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 05/12/00   BY: *N09X* Antony Babu        */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.8.1.5      BY: Steve Nugent    DATE: 10/05/01   ECO: *P004*    */
/* Revision: 1.8.1.6      BY: Katie Hilbert   DATE: 04/15/02   ECO: *P03J*    */
/* $Revision: 1.8.1.7 $     BY: Katie Hilbert   DATE: 06/10/02   ECO: *P083*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/*                                                                            */
/*V8:ConvertMode=Maintenance                                                  */
/******************************************************************************/

/* SCHEDULED ORDER MAINT SUBPROGRAM */

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

define input parameter to_sod_recid as recid.

define variable i       as integer no-undo.
define variable frtitle as character no-undo.

define buffer cmtdet   for cmt_det.
define buffer from_sod for sod_det.
define buffer to_sod   for sod_det.
define buffer from_so  for so_mstr.
define buffer to_so    for so_mstr.

find to_sod where recid(to_sod) = to_sod_recid exclusive-lock.
find to_so where to_so.so_nbr = to_sod.sod_nbr no-lock.

frtitle = " " + getTermLabel("COPY_FROM_ORDER",20) + ": " +
          to_sod.sod_nbr + "  " + getTermLabel("ITEM",8) + ": " +
          to_sod.sod_part + " ".


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
scx_po               colon 11 label "PO Number" format "x(22)"
   scx_line             colon 68
 SKIP(.4)  /*GUI*/
with frame a overlay row 12 column 1 width 80 attr-space side-labels
    NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = frtitle.
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

do on endkey undo, leave:
   do with frame a:
      prompt-for scx_po scx_line
      editing:
         global_part = to_sod.sod_part.

         if frame-field = "scx_po" then do:

            {mfnp05.i scx_ref scx_shipfrom "scx_type = 1
               and scx_shipfrom = to_sod.sod_site
               and scx_shipto = to_so.so_ship
               and scx_part = to_sod.sod_part"
               scx_po "input frame a scx_po"}

            if recno <> ? then
               display
                  scx_po
                  scx_line.
         end.
         else
            if frame-field = "scx_line" then do:
            {mfnp05.i scx_ref scx_order
              "scx_type = 1 and scx_order = to_so.so_nbr"
               scx_line "input frame a scx_line"}

            if recno <> ? then
               display
                  scx_po
                  scx_line.
         end.
         else do:
            status input.
            readkey.
            apply lastkey.
         end.
      end.

      if scx_line entered and not scx_po entered then do:
         find from_sod where from_sod.sod_nbr = to_sod.sod_nbr
            and from_sod.sod_line = input frame a scx_line
            no-lock no-error.

         if available from_sod then
            display
               from_sod.sod_contr_id @ scx_po.
      end.

      find scx_ref where scx_type = 1
         and scx_shipfrom = to_sod.sod_site
         and scx_shipto = to_so.so_ship
         and scx_part = to_sod.sod_part
         and scx_po = input frame a scx_po
      no-lock no-error.

      if not available scx_ref then do:
         {pxmsg.i &MSGNUM=8104 &ERRORLEVEL=3}
         undo, retry.
      end.

      display
         scx_po
         scx_line.
   end.

   find from_sod where from_sod.sod_nbr = scx_order
      and from_sod.sod_line = scx_line no-lock.

   find from_so where from_so.so_nbr = from_sod.sod_nbr no-lock.

   assign
      to_sod.sod_pr_list      = from_sod.sod_pr_list
      to_sod.sod_price        = from_sod.sod_price
      to_sod.sod_acct         = from_sod.sod_acct
      to_sod.sod_sub          = from_sod.sod_sub
      to_sod.sod_cc           = from_sod.sod_cc
      to_sod.sod_dsc_acct     = from_sod.sod_dsc_acct
      to_sod.sod_dsc_sub      = from_sod.sod_dsc_sub
      to_sod.sod_dsc_cc       = from_sod.sod_dsc_cc
      to_sod.sod_taxable      = from_sod.sod_taxable
      to_sod.sod_taxc         = from_sod.sod_taxc
      to_sod.sod_tax_usage    = from_sod.sod_tax_usage
      to_sod.sod_tax_in       = from_sod.sod_tax_in
      to_sod.sod_consume      = from_sod.sod_consume
      to_sod.sod_order_category = from_sod.sod_order_category
      to_sod.sod_type         = from_sod.sod_type
      to_sod.sod_loc          = from_sod.sod_loc
      to_sod.sod_rbkt_days    = from_sod.sod_rbkt_days
      to_sod.sod_rbkt_weeks   = from_sod.sod_rbkt_weeks
      to_sod.sod_rbkt_mths    = from_sod.sod_rbkt_mths
      to_sod.sod_fab_days     = from_sod.sod_fab_days
      to_sod.sod_raw_days     = from_sod.sod_raw_days
      to_sod.sod_pkg_code     = from_sod.sod_pkg_code
      to_sod.sod_start_eff[1] = from_sod.sod_start_eff[1]
      to_sod.sod_end_eff[1]   = from_sod.sod_end_eff[1]
      to_sod.sod_qty_ord      = from_sod.sod_qty_ord
      to_sod.sod_cum_qty[3]   = from_sod.sod_cum_qty[3]
      to_sod.sod_ord_mult     = from_sod.sod_ord_mult
      to_sod.sod_sch_data     = from_sod.sod_sch_data
      to_sod.sod_conrep       = from_sod.sod_conrep
      to_sod.sod_cum_date[1]  = from_sod.sod_cum_date[1]
      to_sod.sod_cum_date[2]  = from_sod.sod_cum_date[2]
      to_sod.sod_cum_date[3]  = from_sod.sod_cum_date[3]
      to_sod.sod_dock         = from_sod.sod_dock
      to_sod.sod_custpart     = from_sod.sod_custpart
      to_sod.sod_pkg_code     = from_sod.sod_pkg_code
      .

   if from_sod.sod_cmtindx > 0 then do:
      {gpcmtcpy.i &old_index=from_sod.sod_cmtindx
         &new_index=to_sod.sod_cmtindx
         &counter=i}
   end.
end.

hide frame a no-pause.
